﻿using MediatR;
using SystemHYS.API.Application.command.DeliveryCommand;
using SystemHYS.Infrstructre.Interface;
namespace SystemHYS.API.Application.commandler.DeliveryCommandler
{
    public class DeliveryDeleteCommandler : IRequestHandler<DeliveryDeleteCommand, int>
    {
        IDeliveryRepository deliveryRepository;
        public DeliveryDeleteCommandler(IDeliveryRepository deliveryRepository)
        {
            this.deliveryRepository = deliveryRepository;
        }
        public async Task<int> Handle(DeliveryDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await deliveryRepository.GetModelAsnc(request.deliveryId);
            list.isDel=true;
            return await deliveryRepository.UpdateAsyn(list);
        }
    }
}
